<%--
 *  File:   FileNameRuleEdit.jsp
 *  Desc:	
 *
 *  Date	  :	 2010/07/22      		    
 *  Author	:  banshang	
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
	//init param
  	String privilegeCode = "E0511";
    String strModuleName = "CFM";
  	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>

<html>
<head>
<title>FileNameRuleEdit</title>
<PageFlow:CheckPageFlow pageName="p_filenamerule"/>
<%@ include file="/inc/AlertError.inc" %>
<%
  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">

function page_add()
{
    if(!checkALLElems(document.getElementById("newdetail"))) return;
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_back(){
	parent.location.href="FileRuleConfigSummary.jsp?<%=OvalTools.randomURL()%>";
}
</script>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_filenamerule">
  <input type="hidden" name="actionname">
  
  <input type="hidden" name="numrows" value="<%= details.size() %>">

<table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr>
    <td valign=top>
      <table border=0 cellpadding=1 cellspacing=0 width="100%">
        <tr>
          <td bgcolor=#000000 style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
            <table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0 width="100%">
              <tr>
                <td  bgcolor=#ffffff style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px">
                  <div id=div2 style="HEIGHT: 415px; OVERFLOW: auto">
                    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">

<%--    top function buttons    --%>
<% if(!isView){%>
                    <tr>
                        <td colspan="20" class="td_right">
                          <a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0"/></a>
                          <%if(details.size()>0 ){%>
                          <a onclick="page_save()"><custom:button type="2" label="L_Save" imgsrc="save_btn.gif" border="0"/></a>
                          <a onclick="page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete_btn.gif" border="0"/></a>
                          <%}%>
                        </td>
                      </tr>
<%}%>

			<tr>
				<td width="22">&nbsp;</td>
                <td class="title_center" width="20%">
                    <%= label.getLabelName("L_Sequence")%><span style="color:red"><%=label.getLabelName("L_Asterisk") %></span>
                </td>
                <td class="title_center" width="20%">
                     <%= label.getLabelName("L_SegmentType ") %><span style="color:red"><%=label.getLabelName("L_Asterisk") %></span>
                </td>
                <td class="title_center" width="25%">
                     <%= label.getLabelName("L_SegmentLength")%>
                </td>
                <td class="title_center" width="*">
                    <%= label.getLabelName("L_Formatter") %>
                </td>
              </tr>
<span id="olddetail" >
                      <logic:iterate id="onerow" collection="<%= details %>" indexId="idx">
                      <tr>
                        <td width="30">
                   <custom:checkbox disabled="<%=isView %>" property="filenameruleid" name="onerow" changedName="deleteids" styleClass="normalradio" />
                   
                        </td>
                        <td><custom:write name="onerow" property="sequence"/></td>

                        <td><custom:selectdic name="onerow" property="type" dictType="FileNameType"  colIndex="<%=idx%>" /></td>
                        
                        <td><custom:text style="border:1px #7F9DB9 solid;"  name="onerow" property="segmentlength" size="6" colIndex="<%=idx%>" /></td>
                        <td><custom:text style="border:1px #7F9DB9 solid;"  name="onerow" property="formatter" size="10" colIndex="<%=idx%>" /></td>
                       
                   </tr>
                      <tr>
                        <td style="display:none">
                            <custom:hidden property="filenameruleid" name="onerow" colIndex="<%=idx%>"/>
                         </td>
                      </tr>
                      </logic:iterate>
</span>


<% if(!isView){%>
<span id="newdetail" >
                      <tr >
                        <td>&nbsp;</td>
                        <td><custom:text style="border:1px #7F9DB9 solid;"  name="newdetail" property="sequence" size="6" command="signlessinteger" label="L_Sequence"/></td>

                        <td><custom:selectdic name="newdetail" property="type" dictType="FileNameType"   /></td>
                        
                        <td><custom:text style="border:1px #7F9DB9 solid;"  name="newdetail" property="segmentlength" size="6"  /></td>
                        
                        <td><custom:text style="border:1px #7F9DB9 solid;"  name="newdetail" property="formatter" size="10"  /></td>
                       
                        
                      </tr>

                      <tr>
                        <td style="display:none">
                            <custom:hidden property="fileruleconfigid"  />
                        </td>
                      </tr>
</span>
<%}%>
                    </table>
                  </div>
                </td>
              </tr>
              
            </table>
          </td>
        </tr>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
         <tr><td class="summary_top"></td></tr>
         <tr>
           <td class="td_center">
          
             <a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="new.gif" border="0" style="width:60"/></a>
          
           </td>
         </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>